import Mock from 'mockjs'
import MockData from './mockData.js'

const Random = Mock.Random

const test = (option) => {
	// console.log(option)
	if(option.body){
		let resData = JSON.parse(option.body)
		if(resData){
			console.log('服务器接收的数据：', resData)
		}
	}
	let data = {
		code: 200,
		msg: 'test success'
	}
	return data
}
Mock.mock('http://localhost:8888/getResource/getData', 'post', test)
//音乐页面轮播列表
const getLunbo = () => {
	const data = {
		code: 200,
		msg: 'success',
		list: MockData.lunbo
	}
	return data
}
Mock.mock('http://localhost:8888/getLunbo', 'post', getLunbo)
//推荐歌手
const getRecommendSinger = () => {
	const data = {
		code: 200,
		msg: 'success',
		list: MockData.recommend_singer
	}
	return data
}
Mock.mock('http://localhost:8888/getRecommendSinger', 'post', getRecommendSinger)
//推荐歌单
const getRecommendSheet = () => {
	const data = {
		code: 200,
		msg: 'success',
		list: MockData.recommend_sheet
	}
	return data
}
Mock.mock('http://localhost:8888/getRecommendSheet', 'post', getRecommendSheet)
//推荐音乐
const getRecommendMusic = () => {
	const data = {
		code: 200,
		msg: 'success',
		list: MockData.recommend_music
	}
	return data
}
Mock.mock('http://localhost:8888/getRecommendMusic', 'post', getRecommendMusic)
//部分排行榜
const getPartOfRank = () => {
	const data = {
		code: 200,
		msg: 'success',
		list: MockData.part_of_rank
	}
	return data
}
Mock.mock('http://localhost:8888/getPartOfRank', 'post', getPartOfRank)